<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Console.Haskeline.Completion</span><span class="hs-special">(</span><span>
</span><span id="line-2"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier">CompletionFunc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-3"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier">Completion</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-4"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#noCompletion"><span class="hs-identifier">noCompletion</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-5"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#simpleCompletion"><span class="hs-identifier">simpleCompletion</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-6"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#fallbackCompletion"><span class="hs-identifier">fallbackCompletion</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-7"></span><span>                            </span><span class="annot"><span class="hs-comment">-- * Word completion</span></span><span>
</span><span id="line-8"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeWord"><span class="hs-identifier">completeWord</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-9"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeWord%27"><span class="hs-identifier">completeWord'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-10"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeWordWithPrev"><span class="hs-identifier">completeWordWithPrev</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-11"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeWordWithPrev%27"><span class="hs-identifier">completeWordWithPrev'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-12"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeQuotedWord"><span class="hs-identifier">completeQuotedWord</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-13"></span><span>                            </span><span class="annot"><span class="hs-comment">-- * Filename completion</span></span><span>
</span><span id="line-14"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeFilename"><span class="hs-identifier">completeFilename</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#listFiles"><span class="hs-identifier">listFiles</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>                            </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#filenameWordBreakChars"><span class="hs-identifier">filenameWordBreakChars</span></a></span><span>
</span><span id="line-17"></span><span>                        </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.html#"><span class="hs-identifier">System.FilePath</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.OldList.html#isPrefixOf"><span class="hs-identifier">isPrefixOf</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Traversable.html#forM"><span class="hs-identifier">forM</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-23"></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Directory.html"><span class="hs-identifier">System.Console.Haskeline.Directory</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Monads.html"><span class="hs-identifier">System.Console.Haskeline.Monads</span></a></span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span class="hs-comment">-- | Performs completions from the given line state.</span><span>
</span><span id="line-28"></span><span class="hs-comment">--</span><span>
</span><span id="line-29"></span><span class="hs-comment">-- The first 'String' argument is the contents of the line to the left of the cursor,</span><span>
</span><span id="line-30"></span><span class="hs-comment">-- reversed.</span><span>
</span><span id="line-31"></span><span class="hs-comment">-- The second 'String' argument is the contents of the line to the right of the cursor.</span><span>
</span><span id="line-32"></span><span class="hs-comment">--</span><span>
</span><span id="line-33"></span><span class="hs-comment">-- The output 'String' is the unused portion of the left half of the line, reversed.</span><span>
</span><span id="line-34"></span><span class="hs-keyword">type</span><span> </span><span id="CompletionFunc"><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-var">CompletionFunc</span></a></span></span><span> </span><span id="local-6989586621679092913"><span class="annot"><a href="#local-6989586621679092913"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679092913"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span class="hs-keyword">data</span><span> </span><span id="Completion"><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-var">Completion</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Completion"><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-var">Completion</span></a></span></span><span> </span><span class="hs-special">{</span><span id="replacement"><span class="annot"><span class="annottext">Completion -&gt; String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var hs-var">replacement</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- ^ Text to insert in line.</span><span>
</span><span id="line-38"></span><span>                        </span><span id="display"><span class="annot"><span class="annottext">Completion -&gt; String
</span><a href="System.Console.Haskeline.Completion.html#display"><span class="hs-identifier hs-var hs-var">display</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>                                </span><span class="hs-comment">-- ^ Text to display when listing</span><span>
</span><span id="line-40"></span><span>                                </span><span class="hs-comment">-- alternatives.</span><span>
</span><span id="line-41"></span><span>                        </span><span id="isFinished"><span class="annot"><span class="annottext">Completion -&gt; Bool
</span><a href="System.Console.Haskeline.Completion.html#isFinished"><span class="hs-identifier hs-var hs-var">isFinished</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-42"></span><span>                            </span><span class="hs-comment">-- ^ Whether this word should be followed by a</span><span>
</span><span id="line-43"></span><span>                            </span><span class="hs-comment">-- space, end quote, etc.</span><span>
</span><span id="line-44"></span><span>                            </span><span class="hs-special">}</span><span>
</span><span id="line-45"></span><span>                    </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679092899"><span id="local-6989586621679092907"><span class="annot"><span class="annottext">Completion -&gt; Completion -&gt; Bool
(Completion -&gt; Completion -&gt; Bool)
-&gt; (Completion -&gt; Completion -&gt; Bool) -&gt; Eq Completion
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: Completion -&gt; Completion -&gt; Bool
$c/= :: Completion -&gt; Completion -&gt; Bool
== :: Completion -&gt; Completion -&gt; Bool
$c== :: Completion -&gt; Completion -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679092868"><span id="local-6989586621679092870"><span id="local-6989586621679092873"><span id="local-6989586621679092876"><span id="local-6989586621679092879"><span id="local-6989586621679092885"><span id="local-6989586621679092893"><span class="annot"><span class="annottext">Eq Completion
Eq Completion
-&gt; (Completion -&gt; Completion -&gt; Ordering)
-&gt; (Completion -&gt; Completion -&gt; Bool)
-&gt; (Completion -&gt; Completion -&gt; Bool)
-&gt; (Completion -&gt; Completion -&gt; Bool)
-&gt; (Completion -&gt; Completion -&gt; Bool)
-&gt; (Completion -&gt; Completion -&gt; Completion)
-&gt; (Completion -&gt; Completion -&gt; Completion)
-&gt; Ord Completion
Completion -&gt; Completion -&gt; Bool
Completion -&gt; Completion -&gt; Ordering
Completion -&gt; Completion -&gt; Completion
forall a.
Eq a
-&gt; (a -&gt; a -&gt; Ordering)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; Ord a
min :: Completion -&gt; Completion -&gt; Completion
$cmin :: Completion -&gt; Completion -&gt; Completion
max :: Completion -&gt; Completion -&gt; Completion
$cmax :: Completion -&gt; Completion -&gt; Completion
&gt;= :: Completion -&gt; Completion -&gt; Bool
$c&gt;= :: Completion -&gt; Completion -&gt; Bool
&gt; :: Completion -&gt; Completion -&gt; Bool
$c&gt; :: Completion -&gt; Completion -&gt; Bool
&lt;= :: Completion -&gt; Completion -&gt; Bool
$c&lt;= :: Completion -&gt; Completion -&gt; Bool
&lt; :: Completion -&gt; Completion -&gt; Bool
$c&lt; :: Completion -&gt; Completion -&gt; Bool
compare :: Completion -&gt; Completion -&gt; Ordering
$ccompare :: Completion -&gt; Completion -&gt; Ordering
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Ord</span></span></span></span></span></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679092852"><span id="local-6989586621679092854"><span id="local-6989586621679092864"><span class="annot"><span class="annottext">Int -&gt; Completion -&gt; ShowS
[Completion] -&gt; ShowS
Completion -&gt; String
(Int -&gt; Completion -&gt; ShowS)
-&gt; (Completion -&gt; String)
-&gt; ([Completion] -&gt; ShowS)
-&gt; Show Completion
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [Completion] -&gt; ShowS
$cshowList :: [Completion] -&gt; ShowS
show :: Completion -&gt; String
$cshow :: Completion -&gt; String
showsPrec :: Int -&gt; Completion -&gt; ShowS
$cshowsPrec :: Int -&gt; Completion -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span class="hs-comment">-- | Disable completion altogether.</span><span>
</span><span id="line-48"></span><span id="local-6989586621679092999"><span class="annot"><a href="System.Console.Haskeline.Completion.html#noCompletion"><span class="hs-identifier hs-type">noCompletion</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092999"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-type">CompletionFunc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092999"><span class="hs-identifier hs-type">m</span></a></span></span><span>
</span><span id="line-49"></span><span id="noCompletion"><span class="annot"><span class="annottext">noCompletion :: forall (m :: * -&gt; *). Monad m =&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#noCompletion"><span class="hs-identifier hs-var hs-var">noCompletion</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679092847"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092847"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String, [Completion]) -&gt; m (String, [Completion])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092847"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span class="hs-comment">--------------</span><span>
</span><span id="line-52"></span><span class="hs-comment">-- Word break functions</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span class="hs-comment">-- | A custom 'CompletionFunc' which completes the word immediately to the left of the cursor.</span><span>
</span><span id="line-55"></span><span class="hs-comment">--</span><span>
</span><span id="line-56"></span><span class="hs-comment">-- A word begins either at the start of the line or after an unescaped whitespace character.</span><span>
</span><span id="line-57"></span><span id="local-6989586621679092993"><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeWord"><span class="hs-identifier hs-type">completeWord</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092993"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span>
</span><span id="line-58"></span><span>        </span><span class="hs-comment">-- ^ An optional escape character</span><span>
</span><span id="line-59"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span class="hs-special">]</span><span class="hs-comment">-- ^ Characters which count as whitespace</span><span>
</span><span id="line-60"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679092993"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ Function to produce a list of possible completions</span><span>
</span><span id="line-61"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-type">CompletionFunc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092993"><span class="hs-identifier hs-type">m</span></a></span></span><span>
</span><span id="line-62"></span><span id="completeWord"><span class="annot"><span class="annottext">completeWord :: forall (m :: * -&gt; *).
Monad m =&gt;
Maybe Char
-&gt; String -&gt; (String -&gt; m [Completion]) -&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#completeWord"><span class="hs-identifier hs-var hs-var">completeWord</span></a></span></span><span> </span><span id="local-6989586621679092844"><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092844"><span class="hs-identifier hs-var">esc</span></a></span></span><span> </span><span id="local-6989586621679092843"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092843"><span class="hs-identifier hs-var">ws</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Char
-&gt; String
-&gt; (String -&gt; String -&gt; m [Completion])
-&gt; CompletionFunc m
forall (m :: * -&gt; *).
Monad m =&gt;
Maybe Char
-&gt; String
-&gt; (String -&gt; String -&gt; m [Completion])
-&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#completeWordWithPrev"><span class="hs-identifier hs-var">completeWordWithPrev</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092844"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092843"><span class="hs-identifier hs-var">ws</span></a></span><span> </span><span class="annot"><span class="annottext">((String -&gt; String -&gt; m [Completion]) -&gt; CompletionFunc m)
-&gt; ((String -&gt; m [Completion])
    -&gt; String -&gt; String -&gt; m [Completion])
-&gt; (String -&gt; m [Completion])
-&gt; CompletionFunc m
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; m [Completion]) -&gt; String -&gt; String -&gt; m [Completion]
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span>
</span><span id="line-63"></span><span>
</span><span id="line-64"></span><span class="hs-comment">-- | The same as 'completeWord' but takes a predicate for the whitespace characters</span><span>
</span><span id="line-65"></span><span id="local-6989586621679092985"><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeWord%27"><span class="hs-identifier hs-type">completeWord'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092985"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span>
</span><span id="line-66"></span><span>        </span><span class="hs-comment">-- ^ An optional escape character</span><span>
</span><span id="line-67"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ Characters which count as whitespace</span><span>
</span><span id="line-68"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679092985"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ Function to produce a list of possible completions</span><span>
</span><span id="line-69"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-type">CompletionFunc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092985"><span class="hs-identifier hs-type">m</span></a></span></span><span>
</span><span id="line-70"></span><span id="completeWord%27"><span class="annot"><span class="annottext">completeWord' :: forall (m :: * -&gt; *).
Monad m =&gt;
Maybe Char
-&gt; (Char -&gt; Bool) -&gt; (String -&gt; m [Completion]) -&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#completeWord%27"><span class="hs-identifier hs-var hs-var">completeWord'</span></a></span></span><span> </span><span id="local-6989586621679092838"><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092838"><span class="hs-identifier hs-var">esc</span></a></span></span><span> </span><span id="local-6989586621679092837"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092837"><span class="hs-identifier hs-var">ws</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Char
-&gt; (Char -&gt; Bool)
-&gt; (String -&gt; String -&gt; m [Completion])
-&gt; CompletionFunc m
forall (m :: * -&gt; *).
Monad m =&gt;
Maybe Char
-&gt; (Char -&gt; Bool)
-&gt; (String -&gt; String -&gt; m [Completion])
-&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#completeWordWithPrev%27"><span class="hs-identifier hs-var">completeWordWithPrev'</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092838"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092837"><span class="hs-identifier hs-var">ws</span></a></span><span> </span><span class="annot"><span class="annottext">((String -&gt; String -&gt; m [Completion]) -&gt; CompletionFunc m)
-&gt; ((String -&gt; m [Completion])
    -&gt; String -&gt; String -&gt; m [Completion])
-&gt; (String -&gt; m [Completion])
-&gt; CompletionFunc m
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; m [Completion]) -&gt; String -&gt; String -&gt; m [Completion]
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span class="hs-comment">-- | A custom 'CompletionFunc' which completes the word immediately to the left of the cursor,</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- and takes into account the line contents to the left of the word.</span><span>
</span><span id="line-74"></span><span class="hs-comment">--</span><span>
</span><span id="line-75"></span><span class="hs-comment">-- A word begins either at the start of the line or after an unescaped whitespace character.</span><span>
</span><span id="line-76"></span><span id="local-6989586621679092991"><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeWordWithPrev"><span class="hs-identifier hs-type">completeWordWithPrev</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092991"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span>
</span><span id="line-77"></span><span>        </span><span class="hs-comment">-- ^ An optional escape character</span><span>
</span><span id="line-78"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span class="hs-special">]</span><span class="hs-comment">-- ^ Characters which count as whitespace</span><span>
</span><span id="line-79"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>  </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679092991"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-80"></span><span>            </span><span class="hs-comment">-- ^ Function to produce a list of possible completions.  The first argument is the</span><span>
</span><span id="line-81"></span><span>            </span><span class="hs-comment">-- line contents to the left of the word, reversed.  The second argument is the word</span><span>
</span><span id="line-82"></span><span>            </span><span class="hs-comment">-- to be completed.</span><span>
</span><span id="line-83"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-type">CompletionFunc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092991"><span class="hs-identifier hs-type">m</span></a></span></span><span>
</span><span id="line-84"></span><span id="completeWordWithPrev"><span class="annot"><span class="annottext">completeWordWithPrev :: forall (m :: * -&gt; *).
Monad m =&gt;
Maybe Char
-&gt; String
-&gt; (String -&gt; String -&gt; m [Completion])
-&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#completeWordWithPrev"><span class="hs-identifier hs-var hs-var">completeWordWithPrev</span></a></span></span><span> </span><span id="local-6989586621679092831"><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092831"><span class="hs-identifier hs-var">esc</span></a></span></span><span> </span><span id="local-6989586621679092830"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092830"><span class="hs-identifier hs-var">ws</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Char
-&gt; (Char -&gt; Bool)
-&gt; (String -&gt; String -&gt; m [Completion])
-&gt; CompletionFunc m
forall (m :: * -&gt; *).
Monad m =&gt;
Maybe Char
-&gt; (Char -&gt; Bool)
-&gt; (String -&gt; String -&gt; m [Completion])
-&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#completeWordWithPrev%27"><span class="hs-identifier hs-var">completeWordWithPrev'</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092831"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; String -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092830"><span class="hs-identifier hs-var">ws</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span class="hs-comment">-- | The same as 'completeWordWithPrev' but takes a predicate for the whitespace characters</span><span>
</span><span id="line-87"></span><span id="local-6989586621679092983"><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeWordWithPrev%27"><span class="hs-identifier hs-type">completeWordWithPrev'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092983"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span>
</span><span id="line-88"></span><span>        </span><span class="hs-comment">-- ^ An optional escape character</span><span>
</span><span id="line-89"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ Characters which count as whitespace</span><span>
</span><span id="line-90"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>  </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679092983"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-91"></span><span>            </span><span class="hs-comment">-- ^ Function to produce a list of possible completions.  The first argument is the</span><span>
</span><span id="line-92"></span><span>            </span><span class="hs-comment">-- line contents to the left of the word, reversed.  The second argument is the word</span><span>
</span><span id="line-93"></span><span>            </span><span class="hs-comment">-- to be completed.</span><span>
</span><span id="line-94"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-type">CompletionFunc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092983"><span class="hs-identifier hs-type">m</span></a></span></span><span>
</span><span id="line-95"></span><span id="completeWordWithPrev%27"><span class="annot"><span class="annottext">completeWordWithPrev' :: forall (m :: * -&gt; *).
Monad m =&gt;
Maybe Char
-&gt; (Char -&gt; Bool)
-&gt; (String -&gt; String -&gt; m [Completion])
-&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#completeWordWithPrev%27"><span class="hs-identifier hs-var hs-var">completeWordWithPrev'</span></a></span></span><span> </span><span id="local-6989586621679092825"><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092825"><span class="hs-identifier hs-var">esc</span></a></span></span><span> </span><span id="local-6989586621679092824"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092824"><span class="hs-identifier hs-var">wpred</span></a></span></span><span> </span><span id="local-6989586621679092823"><span class="annot"><span class="annottext">String -&gt; String -&gt; m [Completion]
</span><a href="#local-6989586621679092823"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679092822"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092822"><span class="hs-identifier hs-var">line</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-96"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679092821"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092821"><span class="hs-identifier hs-var">word</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679092820"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092820"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092825"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-97"></span><span>                        </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092824"><span class="hs-identifier hs-var">wpred</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092822"><span class="hs-identifier hs-var">line</span></a></span><span>
</span><span id="line-98"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679092818"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092818"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621679092817"><span class="hs-identifier hs-var">escapedBreak</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092818"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092822"><span class="hs-identifier hs-var">line</span></a></span><span>
</span><span id="line-99"></span><span>    </span><span id="local-6989586621679092816"><span class="annot"><span class="annottext">[Completion]
</span><a href="#local-6989586621679092816"><span class="hs-identifier hs-var">completions</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; m [Completion]
</span><a href="#local-6989586621679092823"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092820"><span class="hs-identifier hs-var">rest</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShowS
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092821"><span class="hs-identifier hs-var">word</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-100"></span><span>    </span><span class="annot"><span class="annottext">(String, [Completion]) -&gt; m (String, [Completion])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092820"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">(Completion -&gt; Completion) -&gt; [Completion] -&gt; [Completion]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe Char -&gt; (Char -&gt; Bool) -&gt; Completion -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#escapeReplacement"><span class="hs-identifier hs-var">escapeReplacement</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092825"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092824"><span class="hs-identifier hs-var">wpred</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Completion]
</span><a href="#local-6989586621679092816"><span class="hs-identifier hs-var">completions</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-101"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-102"></span><span>    </span><span id="local-6989586621679092817"><span class="annot"><span class="annottext">escapedBreak :: Char -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621679092817"><span class="hs-identifier hs-var hs-var">escapedBreak</span></a></span></span><span> </span><span id="local-6989586621679092811"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092811"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679092810"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092810"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679092809"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092809"><span class="hs-identifier hs-var">d</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679092808"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092808"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092809"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092811"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092810"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092811"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092824"><span class="hs-identifier hs-var">wpred</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092810"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-103"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679092805"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092805"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679092804"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092804"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621679092817"><span class="hs-identifier hs-var">escapedBreak</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092811"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092808"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092810"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">Char -&gt; ShowS
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092805"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092804"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-104"></span><span>    </span><span class="annot"><a href="#local-6989586621679092817"><span class="hs-identifier hs-var">escapedBreak</span></a></span><span> </span><span id="local-6989586621679092803"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092803"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679092802"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092802"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679092801"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092801"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092824"><span class="hs-identifier hs-var">wpred</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092802"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-105"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679092799"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092799"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679092798"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092798"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; (String, String)
</span><a href="#local-6989586621679092817"><span class="hs-identifier hs-var">escapedBreak</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092803"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092801"><span class="hs-identifier hs-var">cs</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092802"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">Char -&gt; ShowS
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092799"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092798"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-106"></span><span>    </span><span class="annot"><a href="#local-6989586621679092817"><span class="hs-identifier hs-var">escapedBreak</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679092797"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092797"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092797"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span class="hs-comment">-- | Create a finished completion out of the given word.</span><span>
</span><span id="line-109"></span><span class="annot"><a href="System.Console.Haskeline.Completion.html#simpleCompletion"><span class="hs-identifier hs-type">simpleCompletion</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span>
</span><span id="line-110"></span><span id="simpleCompletion"><span class="annot"><span class="annottext">simpleCompletion :: String -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#simpleCompletion"><span class="hs-identifier hs-var hs-var">simpleCompletion</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#completion"><span class="hs-identifier hs-var">completion</span></a></span><span>
</span><span id="line-111"></span><span>
</span><span id="line-112"></span><span class="hs-comment">-- NOTE: this is the same as for readline, except that I took out the '\\'</span><span>
</span><span id="line-113"></span><span class="hs-comment">-- so they can be used as a path separator.</span><span>
</span><span id="line-114"></span><span class="annot"><a href="System.Console.Haskeline.Completion.html#filenameWordBreakChars"><span class="hs-identifier hs-type">filenameWordBreakChars</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-115"></span><span id="filenameWordBreakChars"><span class="annot"><span class="annottext">filenameWordBreakChars :: String
</span><a href="System.Console.Haskeline.Completion.html#filenameWordBreakChars"><span class="hs-identifier hs-var hs-var">filenameWordBreakChars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; \t\n`@$&gt;&lt;=;|&amp;{(&quot;</span></span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span class="hs-comment">-- A completion command for file and folder names.</span><span>
</span><span id="line-118"></span><span id="local-6989586621679092971"><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeFilename"><span class="hs-identifier hs-type">completeFilename</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092971"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-type">CompletionFunc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092971"><span class="hs-identifier hs-type">m</span></a></span></span><span>
</span><span id="line-119"></span><span id="completeFilename"><span class="annot"><span class="annottext">completeFilename :: forall (m :: * -&gt; *). MonadIO m =&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#completeFilename"><span class="hs-identifier hs-var hs-var">completeFilename</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Char
-&gt; String
-&gt; (String -&gt; m [Completion])
-&gt; CompletionFunc m
-&gt; CompletionFunc m
forall (m :: * -&gt; *).
Monad m =&gt;
Maybe Char
-&gt; String
-&gt; (String -&gt; m [Completion])
-&gt; CompletionFunc m
-&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#completeQuotedWord"><span class="hs-identifier hs-var">completeQuotedWord</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Maybe Char
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;'&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; m [Completion]
forall (m :: * -&gt; *). MonadIO m =&gt; String -&gt; m [Completion]
</span><a href="System.Console.Haskeline.Completion.html#listFiles"><span class="hs-identifier hs-var">listFiles</span></a></span><span>
</span><span id="line-120"></span><span>                        </span><span class="annot"><span class="annottext">(CompletionFunc m -&gt; CompletionFunc m)
-&gt; CompletionFunc m -&gt; CompletionFunc m
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
-&gt; String -&gt; (String -&gt; m [Completion]) -&gt; CompletionFunc m
forall (m :: * -&gt; *).
Monad m =&gt;
Maybe Char
-&gt; String -&gt; (String -&gt; m [Completion]) -&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#completeWord"><span class="hs-identifier hs-var">completeWord</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Maybe Char
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;\'&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="System.Console.Haskeline.Completion.html#filenameWordBreakChars"><span class="hs-identifier hs-var">filenameWordBreakChars</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-121"></span><span>                                </span><span class="annot"><span class="annottext">String -&gt; m [Completion]
forall (m :: * -&gt; *). MonadIO m =&gt; String -&gt; m [Completion]
</span><a href="System.Console.Haskeline.Completion.html#listFiles"><span class="hs-identifier hs-var">listFiles</span></a></span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span class="annot"><a href="System.Console.Haskeline.Completion.html#completion"><span class="hs-identifier hs-type">completion</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span>
</span><span id="line-124"></span><span id="completion"><span class="annot"><span class="annottext">completion :: String -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#completion"><span class="hs-identifier hs-var hs-var">completion</span></a></span></span><span> </span><span id="local-6989586621679092788"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092788"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-var">Completion</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092788"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092788"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span class="annot"><a href="System.Console.Haskeline.Completion.html#setReplacement"><span class="hs-identifier hs-type">setReplacement</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span>
</span><span id="line-127"></span><span id="setReplacement"><span class="annot"><span class="annottext">setReplacement :: ShowS -&gt; Completion -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#setReplacement"><span class="hs-identifier hs-var hs-var">setReplacement</span></a></span></span><span> </span><span id="local-6989586621679092786"><span class="annot"><span class="annottext">ShowS
</span><a href="#local-6989586621679092786"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679092785"><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092785"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092785"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">replacement :: String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var">replacement</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShowS
</span><a href="#local-6989586621679092786"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Completion -&gt; String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var hs-var">replacement</span></a></span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092785"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span class="annot"><a href="System.Console.Haskeline.Completion.html#escapeReplacement"><span class="hs-identifier hs-type">escapeReplacement</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span>
</span><span id="line-130"></span><span id="escapeReplacement"><span class="annot"><span class="annottext">escapeReplacement :: Maybe Char -&gt; (Char -&gt; Bool) -&gt; Completion -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#escapeReplacement"><span class="hs-identifier hs-var hs-var">escapeReplacement</span></a></span></span><span> </span><span id="local-6989586621679092784"><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092784"><span class="hs-identifier hs-var">esc</span></a></span></span><span> </span><span id="local-6989586621679092783"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092783"><span class="hs-identifier hs-var">wpred</span></a></span></span><span> </span><span id="local-6989586621679092782"><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092782"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092784"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-131"></span><span>    </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092782"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-132"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679092781"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092781"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092782"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">replacement :: String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var">replacement</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; ShowS
</span><a href="#local-6989586621679092780"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092781"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Completion -&gt; String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var hs-var">replacement</span></a></span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092782"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span class="hs-special">}</span><span>
</span><span id="line-133"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-134"></span><span>    </span><span id="local-6989586621679092780"><span class="annot"><span class="annottext">escape :: Char -&gt; ShowS
</span><a href="#local-6989586621679092780"><span class="hs-identifier hs-var hs-var">escape</span></a></span></span><span> </span><span id="local-6989586621679092778"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092778"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679092777"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092777"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679092776"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092776"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092777"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092778"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092783"><span class="hs-identifier hs-var">wpred</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092777"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092778"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; ShowS
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092777"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; ShowS
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; ShowS
</span><a href="#local-6989586621679092780"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092778"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092776"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-135"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092777"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; ShowS
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; ShowS
</span><a href="#local-6989586621679092780"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092778"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092776"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-136"></span><span>    </span><span class="annot"><a href="#local-6989586621679092780"><span class="hs-identifier hs-var">escape</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-137"></span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span class="hs-comment">---------</span><span>
</span><span id="line-140"></span><span class="hs-comment">-- Quoted completion</span><span>
</span><span id="line-141"></span><span id="local-6989586621679092967"><span class="annot"><a href="System.Console.Haskeline.Completion.html#completeQuotedWord"><span class="hs-identifier hs-type">completeQuotedWord</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092967"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span> </span><span class="hs-comment">-- ^ An optional escape character</span><span>
</span><span id="line-142"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- ^ Characters which set off quotes</span><span>
</span><span id="line-143"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679092967"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ Function to produce a list of possible completions</span><span>
</span><span id="line-144"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-type">CompletionFunc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092967"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-comment">-- ^ Alternate completion to perform if the</span><span>
</span><span id="line-145"></span><span>                                            </span><span class="hs-comment">-- cursor is not at a quoted word</span><span>
</span><span id="line-146"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-type">CompletionFunc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092967"><span class="hs-identifier hs-type">m</span></a></span></span><span>
</span><span id="line-147"></span><span id="completeQuotedWord"><span class="annot"><span class="annottext">completeQuotedWord :: forall (m :: * -&gt; *).
Monad m =&gt;
Maybe Char
-&gt; String
-&gt; (String -&gt; m [Completion])
-&gt; CompletionFunc m
-&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#completeQuotedWord"><span class="hs-identifier hs-var hs-var">completeQuotedWord</span></a></span></span><span> </span><span id="local-6989586621679092770"><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092770"><span class="hs-identifier hs-var">esc</span></a></span></span><span> </span><span id="local-6989586621679092769"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092769"><span class="hs-identifier hs-var">qs</span></a></span></span><span> </span><span id="local-6989586621679092768"><span class="annot"><span class="annottext">String -&gt; m [Completion]
</span><a href="#local-6989586621679092768"><span class="hs-identifier hs-var">completer</span></a></span></span><span> </span><span id="local-6989586621679092767"><span class="annot"><span class="annottext">CompletionFunc m
</span><a href="#local-6989586621679092767"><span class="hs-identifier hs-var">alterative</span></a></span></span><span> </span><span id="local-6989586621679092766"><span class="annot"><span class="annottext">line :: (String, String)
</span><a href="#local-6989586621679092766"><span class="hs-identifier hs-var">line</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679092765"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092765"><span class="hs-identifier hs-var">left</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-148"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe Char -&gt; String -&gt; String -&gt; Maybe (String, String)
</span><a href="System.Console.Haskeline.Completion.html#splitAtQuote"><span class="hs-identifier hs-var">splitAtQuote</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092770"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092769"><span class="hs-identifier hs-var">qs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092765"><span class="hs-identifier hs-var">left</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-149"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679092763"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092763"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679092762"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092762"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Maybe Char -&gt; String -&gt; String -&gt; Bool
</span><a href="System.Console.Haskeline.Completion.html#isUnquoted"><span class="hs-identifier hs-var">isUnquoted</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092770"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092769"><span class="hs-identifier hs-var">qs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092762"><span class="hs-identifier hs-var">rest</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-150"></span><span>        </span><span id="local-6989586621679092760"><span class="annot"><span class="annottext">[Completion]
</span><a href="#local-6989586621679092760"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; m [Completion]
</span><a href="#local-6989586621679092768"><span class="hs-identifier hs-var">completer</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShowS
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092763"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-151"></span><span>        </span><span class="annot"><span class="annottext">(String, [Completion]) -&gt; m (String, [Completion])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092762"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Completion -&gt; Completion) -&gt; [Completion] -&gt; [Completion]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Completion -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#addQuotes"><span class="hs-identifier hs-var">addQuotes</span></a></span><span> </span><span class="annot"><span class="annottext">(Completion -&gt; Completion)
-&gt; (Completion -&gt; Completion) -&gt; Completion -&gt; Completion
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char -&gt; (Char -&gt; Bool) -&gt; Completion -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#escapeReplacement"><span class="hs-identifier hs-var">escapeReplacement</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092770"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; String -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092769"><span class="hs-identifier hs-var">qs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Completion]
</span><a href="#local-6989586621679092760"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-152"></span><span>    </span><span class="annot"><span class="annottext">Maybe (String, String)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CompletionFunc m
</span><a href="#local-6989586621679092767"><span class="hs-identifier hs-var">alterative</span></a></span><span> </span><span class="annot"><span class="annottext">(String, String)
</span><a href="#local-6989586621679092766"><span class="hs-identifier hs-var">line</span></a></span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span class="annot"><a href="System.Console.Haskeline.Completion.html#addQuotes"><span class="hs-identifier hs-type">addQuotes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span>
</span><span id="line-155"></span><span id="addQuotes"><span class="annot"><span class="annottext">addQuotes :: Completion -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#addQuotes"><span class="hs-identifier hs-var hs-var">addQuotes</span></a></span></span><span> </span><span id="local-6989586621679092758"><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092758"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Completion -&gt; Bool
</span><a href="System.Console.Haskeline.Completion.html#isFinished"><span class="hs-identifier hs-var hs-var">isFinished</span></a></span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092758"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092758"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">replacement :: String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var">replacement</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Completion -&gt; String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var hs-var">replacement</span></a></span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092758"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;&quot;</span></span><span class="hs-special">}</span><span>
</span><span id="line-157"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092758"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">replacement :: String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var">replacement</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\&quot;&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Completion -&gt; String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var hs-var">replacement</span></a></span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092758"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-158"></span><span>
</span><span id="line-159"></span><span class="annot"><a href="System.Console.Haskeline.Completion.html#splitAtQuote"><span class="hs-identifier hs-type">splitAtQuote</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-160"></span><span id="splitAtQuote"><span class="annot"><span class="annottext">splitAtQuote :: Maybe Char -&gt; String -&gt; String -&gt; Maybe (String, String)
</span><a href="System.Console.Haskeline.Completion.html#splitAtQuote"><span class="hs-identifier hs-var hs-var">splitAtQuote</span></a></span></span><span> </span><span id="local-6989586621679092757"><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092757"><span class="hs-identifier hs-var">esc</span></a></span></span><span> </span><span id="local-6989586621679092756"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092756"><span class="hs-identifier hs-var">qs</span></a></span></span><span> </span><span id="local-6989586621679092755"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092755"><span class="hs-identifier hs-var">line</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092755"><span class="hs-identifier hs-var">line</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-161"></span><span>    </span><span id="local-6989586621679092754"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092754"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679092753"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092753"><span class="hs-identifier hs-var">e</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679092752"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092752"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092751"><span class="hs-identifier hs-var">isEscape</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092753"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092750"><span class="hs-identifier hs-var">isEscapable</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092754"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-162"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-163"></span><span>                            </span><span class="hs-special">(</span><span id="local-6989586621679092749"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092749"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679092748"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092748"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Char -&gt; String -&gt; String -&gt; Maybe (String, String)
</span><a href="System.Console.Haskeline.Completion.html#splitAtQuote"><span class="hs-identifier hs-var">splitAtQuote</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092757"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092756"><span class="hs-identifier hs-var">qs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092752"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-164"></span><span>                            </span><span class="annot"><span class="annottext">(String, String) -&gt; Maybe (String, String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092754"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">Char -&gt; ShowS
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092749"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092748"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-165"></span><span>    </span><span id="local-6989586621679092747"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092747"><span class="hs-identifier hs-var">q</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679092746"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092746"><span class="hs-identifier hs-var">cs</span></a></span></span><span>   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092745"><span class="hs-identifier hs-var">isQuote</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092747"><span class="hs-identifier hs-var">q</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(String, String) -&gt; Maybe (String, String)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092746"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-166"></span><span>    </span><span id="local-6989586621679092744"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092744"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679092743"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092743"><span class="hs-identifier hs-var">cs</span></a></span></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-167"></span><span>                            </span><span class="hs-special">(</span><span id="local-6989586621679092742"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092742"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679092741"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092741"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Char -&gt; String -&gt; String -&gt; Maybe (String, String)
</span><a href="System.Console.Haskeline.Completion.html#splitAtQuote"><span class="hs-identifier hs-var">splitAtQuote</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092757"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092756"><span class="hs-identifier hs-var">qs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092743"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-168"></span><span>                            </span><span class="annot"><span class="annottext">(String, String) -&gt; Maybe (String, String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092744"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">Char -&gt; ShowS
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092742"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092741"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-169"></span><span>    </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (String, String)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-170"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-171"></span><span>    </span><span id="local-6989586621679092745"><span class="annot"><span class="annottext">isQuote :: Char -&gt; Bool
</span><a href="#local-6989586621679092745"><span class="hs-identifier hs-var hs-var">isQuote</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; String -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092756"><span class="hs-identifier hs-var">qs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-172"></span><span>    </span><span id="local-6989586621679092751"><span class="annot"><span class="annottext">isEscape :: Char -&gt; Bool
</span><a href="#local-6989586621679092751"><span class="hs-identifier hs-var hs-var">isEscape</span></a></span></span><span> </span><span id="local-6989586621679092735"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092735"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Maybe Char
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092735"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char -&gt; Maybe Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092757"><span class="hs-identifier hs-var">esc</span></a></span><span>
</span><span id="line-173"></span><span>    </span><span id="local-6989586621679092750"><span class="annot"><span class="annottext">isEscapable :: Char -&gt; Bool
</span><a href="#local-6989586621679092750"><span class="hs-identifier hs-var hs-var">isEscapable</span></a></span></span><span> </span><span id="local-6989586621679092734"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092734"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092751"><span class="hs-identifier hs-var">isEscape</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092734"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679092745"><span class="hs-identifier hs-var">isQuote</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092734"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span class="annot"><a href="System.Console.Haskeline.Completion.html#isUnquoted"><span class="hs-identifier hs-type">isUnquoted</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Char</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-176"></span><span id="isUnquoted"><span class="annot"><span class="annottext">isUnquoted :: Maybe Char -&gt; String -&gt; String -&gt; Bool
</span><a href="System.Console.Haskeline.Completion.html#isUnquoted"><span class="hs-identifier hs-var hs-var">isUnquoted</span></a></span></span><span> </span><span id="local-6989586621679092733"><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092733"><span class="hs-identifier hs-var">esc</span></a></span></span><span> </span><span id="local-6989586621679092732"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092732"><span class="hs-identifier hs-var">qs</span></a></span></span><span> </span><span id="local-6989586621679092731"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092731"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe Char -&gt; String -&gt; String -&gt; Maybe (String, String)
</span><a href="System.Console.Haskeline.Completion.html#splitAtQuote"><span class="hs-identifier hs-var">splitAtQuote</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092733"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092732"><span class="hs-identifier hs-var">qs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092731"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-177"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621679092730"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092730"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe Char -&gt; String -&gt; String -&gt; Bool
</span><a href="System.Console.Haskeline.Completion.html#isUnquoted"><span class="hs-identifier hs-var">isUnquoted</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="#local-6989586621679092733"><span class="hs-identifier hs-var">esc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092732"><span class="hs-identifier hs-var">qs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092730"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-178"></span><span>    </span><span class="annot"><span class="annottext">Maybe (String, String)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span class="hs-comment">-- | List all of the files or folders beginning with this path.</span><span>
</span><span id="line-182"></span><span id="local-6989586621679092966"><span class="annot"><a href="System.Console.Haskeline.Completion.html#listFiles"><span class="hs-identifier hs-type">listFiles</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092966"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679092966"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.Haskeline.Completion.html#Completion"><span class="hs-identifier hs-type">Completion</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-183"></span><span id="listFiles"><span class="annot"><span class="annottext">listFiles :: forall (m :: * -&gt; *). MonadIO m =&gt; String -&gt; m [Completion]
</span><a href="System.Console.Haskeline.Completion.html#listFiles"><span class="hs-identifier hs-var hs-var">listFiles</span></a></span></span><span> </span><span id="local-6989586621679092715"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092715"><span class="hs-identifier hs-var">path</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO [Completion] -&gt; m [Completion]
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO [Completion] -&gt; m [Completion])
-&gt; IO [Completion] -&gt; m [Completion]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-184"></span><span>    </span><span id="local-6989586621679092713"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092713"><span class="hs-identifier hs-var">fixedDir</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO String
</span><a href="System.Console.Haskeline.Completion.html#fixPath"><span class="hs-identifier hs-var">fixPath</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092711"><span class="hs-identifier hs-var">dir</span></a></span><span>
</span><span id="line-185"></span><span>    </span><span id="local-6989586621679092710"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679092710"><span class="hs-identifier hs-var">dirExists</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO Bool
</span><a href="System.Console.Haskeline.Directory.html#doesDirectoryExist"><span class="hs-identifier hs-var">doesDirectoryExist</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092713"><span class="hs-identifier hs-var">fixedDir</span></a></span><span>
</span><span id="line-186"></span><span>    </span><span class="hs-comment">-- get all of the files in that directory, as basenames</span><span>
</span><span id="line-187"></span><span>    </span><span id="local-6989586621679092708"><span class="annot"><span class="annottext">[Completion]
</span><a href="#local-6989586621679092708"><span class="hs-identifier hs-var">allFiles</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679092710"><span class="hs-identifier hs-var">dirExists</span></a></span><span>
</span><span id="line-188"></span><span>                    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">[Completion] -&gt; IO [Completion]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-189"></span><span>                    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [Completion]) -&gt; IO [String] -&gt; IO [Completion]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; Completion) -&gt; [String] -&gt; [Completion]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#completion"><span class="hs-identifier hs-var">completion</span></a></span><span> </span><span class="annot"><span class="annottext">([String] -&gt; [Completion])
-&gt; ([String] -&gt; [String]) -&gt; [String] -&gt; [Completion]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String]
</span><a href="#local-6989586621679092707"><span class="hs-identifier hs-var">filterPrefix</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-190"></span><span>                            </span><span class="annot"><span class="annottext">(IO [String] -&gt; IO [Completion]) -&gt; IO [String] -&gt; IO [Completion]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; IO [String]
</span><a href="System.Console.Haskeline.Directory.html#getDirectoryContents"><span class="hs-identifier hs-var">getDirectoryContents</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092713"><span class="hs-identifier hs-var">fixedDir</span></a></span><span>
</span><span id="line-191"></span><span>    </span><span class="hs-comment">-- The replacement text should include the directory part, and also</span><span>
</span><span id="line-192"></span><span>    </span><span class="hs-comment">-- have a trailing slash if it's itself a directory.</span><span>
</span><span id="line-193"></span><span>    </span><span class="annot"><span class="annottext">[Completion] -&gt; (Completion -&gt; IO Completion) -&gt; IO [Completion]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
t a -&gt; (a -&gt; m b) -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#forM"><span class="hs-identifier hs-var">forM</span></a></span><span> </span><span class="annot"><span class="annottext">[Completion]
</span><a href="#local-6989586621679092708"><span class="hs-identifier hs-var">allFiles</span></a></span><span> </span><span class="annot"><span class="annottext">((Completion -&gt; IO Completion) -&gt; IO [Completion])
-&gt; (Completion -&gt; IO Completion) -&gt; IO [Completion]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679092705"><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092705"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-194"></span><span>            </span><span id="local-6989586621679092704"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679092704"><span class="hs-identifier hs-var">isDir</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO Bool
</span><a href="System.Console.Haskeline.Directory.html#doesDirectoryExist"><span class="hs-identifier hs-var">doesDirectoryExist</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092713"><span class="hs-identifier hs-var">fixedDir</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C%2F%3E"><span class="hs-operator hs-var">&lt;/&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Completion -&gt; String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var hs-var">replacement</span></a></span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092705"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-195"></span><span>            </span><span class="annot"><span class="annottext">Completion -&gt; IO Completion
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Completion -&gt; IO Completion) -&gt; Completion -&gt; IO Completion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; Completion -&gt; Completion
</span><a href="System.Console.Haskeline.Completion.html#setReplacement"><span class="hs-identifier hs-var">setReplacement</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS
</span><a href="#local-6989586621679092702"><span class="hs-identifier hs-var">fullName</span></a></span><span> </span><span class="annot"><span class="annottext">(Completion -&gt; Completion) -&gt; Completion -&gt; Completion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Completion -&gt; Completion
</span><a href="#local-6989586621679092701"><span class="hs-identifier hs-var">alterIfDir</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679092704"><span class="hs-identifier hs-var">isDir</span></a></span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092705"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-196"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-197"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679092711"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092711"><span class="hs-identifier hs-var">dir</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679092700"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092700"><span class="hs-identifier hs-var">file</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; (String, String)
</span><a href="../../filepath/src/System.FilePath.Windows.html#splitFileName"><span class="hs-identifier hs-var">splitFileName</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092715"><span class="hs-identifier hs-var">path</span></a></span><span>
</span><span id="line-198"></span><span>    </span><span id="local-6989586621679092707"><span class="annot"><span class="annottext">filterPrefix :: [String] -&gt; [String]
</span><a href="#local-6989586621679092707"><span class="hs-identifier hs-var hs-var">filterPrefix</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; Bool) -&gt; [String] -&gt; [String]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679092694"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092694"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#notElem"><span class="hs-identifier hs-var">notElem</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092694"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.&quot;</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;..&quot;</span></span><span class="hs-special">]</span><span>
</span><span id="line-199"></span><span>                                        </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092700"><span class="hs-identifier hs-var">file</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; [a] -&gt; [a] -&gt; Bool
</span><a href="../../base/src/Data.OldList.html#isPrefixOf"><span class="hs-operator hs-var">`isPrefixOf`</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092694"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-200"></span><span>    </span><span id="local-6989586621679092701"><span class="annot"><span class="annottext">alterIfDir :: Bool -&gt; Completion -&gt; Completion
</span><a href="#local-6989586621679092701"><span class="hs-identifier hs-var hs-var">alterIfDir</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span id="local-6989586621679092692"><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092692"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092692"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-201"></span><span>    </span><span class="annot"><a href="#local-6989586621679092701"><span class="hs-identifier hs-var">alterIfDir</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span id="local-6989586621679092691"><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092691"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092691"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">replacement :: String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var">replacement</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShowS
</span><a href="../../filepath/src/System.FilePath.Windows.html#addTrailingPathSeparator"><span class="hs-identifier hs-var">addTrailingPathSeparator</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Completion -&gt; String
</span><a href="System.Console.Haskeline.Completion.html#replacement"><span class="hs-identifier hs-var hs-var">replacement</span></a></span><span> </span><span class="annot"><span class="annottext">Completion
</span><a href="#local-6989586621679092691"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-202"></span><span>                            </span><span class="annot"><span class="annottext">isFinished :: Bool
</span><a href="System.Console.Haskeline.Completion.html#isFinished"><span class="hs-identifier hs-var">isFinished</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">}</span><span>
</span><span id="line-203"></span><span>    </span><span id="local-6989586621679092702"><span class="annot"><span class="annottext">fullName :: ShowS
</span><a href="#local-6989586621679092702"><span class="hs-identifier hs-var hs-var">fullName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="../../filepath/src/System.FilePath.Windows.html#replaceFileName"><span class="hs-identifier hs-var">replaceFileName</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092715"><span class="hs-identifier hs-var">path</span></a></span><span>
</span><span id="line-204"></span><span>
</span><span id="line-205"></span><span class="hs-comment">-- turn a user-visible path into an internal version useable by System.FilePath.</span><span>
</span><span id="line-206"></span><span class="annot"><a href="System.Console.Haskeline.Completion.html#fixPath"><span class="hs-identifier hs-type">fixPath</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-207"></span><span class="hs-comment">-- For versions of filepath &lt; 1.2</span><span>
</span><span id="line-208"></span><span id="fixPath"><span class="annot"><span class="annottext">fixPath :: String -&gt; IO String
</span><a href="System.Console.Haskeline.Completion.html#fixPath"><span class="hs-identifier hs-var hs-var">fixPath</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO String
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.&quot;</span></span><span>
</span><span id="line-209"></span><span class="annot"><a href="System.Console.Haskeline.Completion.html#fixPath"><span class="hs-identifier hs-var">fixPath</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'~'</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679092688"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092688"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679092687"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092687"><span class="hs-identifier hs-var">path</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../filepath/src/System.FilePath.Windows.html#isPathSeparator"><span class="hs-identifier hs-var">isPathSeparator</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679092688"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-210"></span><span>    </span><span id="local-6989586621679092685"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092685"><span class="hs-identifier hs-var">home</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO String
</span><a href="System.Console.Haskeline.Directory.html#getHomeDirectory"><span class="hs-identifier hs-var">getHomeDirectory</span></a></span><span>
</span><span id="line-211"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; IO String
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092685"><span class="hs-identifier hs-var">home</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C%2F%3E"><span class="hs-operator hs-var">&lt;/&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092687"><span class="hs-identifier hs-var">path</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-212"></span><span class="annot"><a href="System.Console.Haskeline.Completion.html#fixPath"><span class="hs-identifier hs-var">fixPath</span></a></span><span> </span><span id="local-6989586621679092683"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092683"><span class="hs-identifier hs-var">path</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO String
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679092683"><span class="hs-identifier hs-var">path</span></a></span><span>
</span><span id="line-213"></span><span>
</span><span id="line-214"></span><span class="hs-comment">-- | If the first completer produces no suggestions, fallback to the second</span><span>
</span><span id="line-215"></span><span class="hs-comment">-- completer's output.</span><span>
</span><span id="line-216"></span><span id="local-6989586621679092949"><span class="annot"><a href="System.Console.Haskeline.Completion.html#fallbackCompletion"><span class="hs-identifier hs-type">fallbackCompletion</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092949"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-type">CompletionFunc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092949"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-type">CompletionFunc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092949"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.Haskeline.Completion.html#CompletionFunc"><span class="hs-identifier hs-type">CompletionFunc</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679092949"><span class="hs-identifier hs-type">m</span></a></span></span><span>
</span><span id="line-217"></span><span id="fallbackCompletion"><span class="annot"><span class="annottext">fallbackCompletion :: forall (m :: * -&gt; *).
Monad m =&gt;
CompletionFunc m -&gt; CompletionFunc m -&gt; CompletionFunc m
</span><a href="System.Console.Haskeline.Completion.html#fallbackCompletion"><span class="hs-identifier hs-var hs-var">fallbackCompletion</span></a></span></span><span> </span><span id="local-6989586621679092678"><span class="annot"><span class="annottext">CompletionFunc m
</span><a href="#local-6989586621679092678"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679092677"><span class="annot"><span class="annottext">CompletionFunc m
</span><a href="#local-6989586621679092677"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621679092676"><span class="annot"><span class="annottext">(String, String)
</span><a href="#local-6989586621679092676"><span class="hs-identifier hs-var">input</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-218"></span><span>    </span><span id="local-6989586621679092675"><span class="annot"><span class="annottext">(String, [Completion])
</span><a href="#local-6989586621679092675"><span class="hs-identifier hs-var">aCompletions</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CompletionFunc m
</span><a href="#local-6989586621679092678"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">(String, String)
</span><a href="#local-6989586621679092676"><span class="hs-identifier hs-var">input</span></a></span><span>
</span><span id="line-219"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[Completion] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String, [Completion]) -&gt; [Completion]
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">(String, [Completion])
</span><a href="#local-6989586621679092675"><span class="hs-identifier hs-var">aCompletions</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">CompletionFunc m
</span><a href="#local-6989586621679092677"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">(String, String)
</span><a href="#local-6989586621679092676"><span class="hs-identifier hs-var">input</span></a></span><span>
</span><span id="line-221"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">(String, [Completion]) -&gt; m (String, [Completion])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(String, [Completion])
</span><a href="#local-6989586621679092675"><span class="hs-identifier hs-var">aCompletions</span></a></span><span>
</span><span id="line-222"></span></pre></body></html>